﻿@using GH.Northwind.Business.Entities
@model IEnumerable<Product>

@{
    ViewBag.Title = "AllProducts";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>AllProducts</h2>

<p>
    @Html.ActionLink("Create New", "CreateProduct")
</p>
<table>
    <tr>
        <th></th>
        <th>
            ProductName
        </th>
        <th>
            SupplierID
        </th>
        <th>
            CategoryID
        </th>
        <th>
            QuantityPerUnit
        </th>
        <th>
            UnitPrice
        </th>
        <th>
            UnitsInStock
        </th>
        <th>
            UnitsOnOrder
        </th>
        <th>
            ReorderLevel
        </th>
        <th>
            Discontinued
        </th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.ActionLink("Edit", "EditProduct", new { id = item.ProductID }) |
                @Html.ActionLink("Details", "DetailsProduct", new { id = item.ProductID }) |
                @Html.ActionLink("Delete", "DeleteProduct", new {id = item.ProductID})
            </td>
            <td>
                @item.ProductName
            </td>
            <td>
                @item.SupplierID
            </td>
            <td>
                @item.CategoryID
            </td>
            <td>
                @item.QuantityPerUnit
            </td>
            <td>
                @String.Format("{0:F}", item.UnitPrice)
            </td>
            <td>
                @item.UnitsInStock
            </td>
            <td>
                @item.UnitsOnOrder
            </td>
            <td>
                @item.ReorderLevel
            </td>
            <td>
                @item.Discontinued
            </td>
        </tr>
    }

</table>

